import {
	defineStore
} from 'pinia'

export const useFlightStore = defineStore('flight', {
	state: () => ({
		_dcity_code: '',
		_dcity_name: "",
		_acity_code: "",
		_acity_name: "",
		_ddate: "",
		_route_type: 0,
		_airline_code: '',
	}),
	getters: {
		dcity_code: (state) => state._dcity_code,
		dcity_name: (state) => state._dcity_name,
		acity_code: (state) => state._acity_code,
		acity_name: (state) => state._acity_name,
		ddate: (state) => state._ddate,
		route_type: (state) => state._route_type,
		airline_code: (state) => state._airline_code,

	},
	actions: {
		reset() {
			
		},
		setSearchParams(payload) {
			this._dcity_code = payload.dcity_code
			this._dcity_name = payload.dcity_name
			this._acity_code = payload.acity_code
			this._acity_name = payload.acity_name
			this._ddate = payload.ddate
			this._route_type = payload.route_type
			this._airline_code = payload.airline_code
		},
		// updateHotelInfo(newHotelInfo) {
		// 	this._hotelInfo = {
		// 		...this._hotelInfo,
		// 		...newHotelInfo
		// 	}
		// 	uni.setStorageSync('hotel_info', JSON.stringify(this._hotelInfo))
		// },
		// updateOrderInfo(newOrderInfo) {
		// 	this._orderInfo = {
		// 		...this._orderInfo,
		// 		...newOrderInfo
		// 	}
		// 	uni.setStorageSync('hotel_order_info', JSON.stringify(this._orderInfo))
		// },
		// updateRatePlan(newRatePlan) {
		// 	this._ratePlan = {
		// 		...this._ratePlan,
		// 		...newRatePlan
		// 	}
		// 	uni.setStorageSync('hotel_rate_plan', JSON.stringify(this._ratePlan))
		// }
	}
})